package com.xtinno.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xtinno.mapper.PromptTemplateMapper;
import com.xtinno.pojo.po.PromptTemplatePO;
import com.xtinno.service.PromptTemplateService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;


/**
 * 提示词模板
 *
 * @author GuanLei
 * @time 2025/5/6 17:12
 */
@Service
public class PromptTemplateServiceImpl extends ServiceImpl<PromptTemplateMapper, PromptTemplatePO> implements PromptTemplateService {

    @Override
    public PromptTemplatePO getPromptTemplatePoByTemplateCode(String templateCode) {
        if (StringUtils.isEmpty(templateCode)){
            return null;
        }
        LambdaQueryWrapper<PromptTemplatePO> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(PromptTemplatePO::getTemplateCode, templateCode);
        return this.getOne(queryWrapper);
    }
}
